<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
</h:head>
<h:body styleClass="Corpo" style="font-size:13px;">
	<h:form id="formFiltroIniciar">
		<div align="center" class="DivCentralizada"
			style="left: 50%; margin-left: -500px;">
			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.label_destino}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu value="#{gerenciaChamadoTela.destinoChamadoFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{gerenciaChamadoTela.destinosFiltro}"
						var="tipo" itemLabel="#{tipo.destinoChamado}"
						itemValue="#{tipo.destinoChamado}" style="font-size: 13px;" />
					<p:ajax global="false" />
				</p:selectOneMenu>
			</div>
			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.solicita_solicitante}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu value="#{gerenciaChamadoTela.solicitanteFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="" />
					<f:selectItems value="#{gerenciaChamadoTela.solicitantesFiltro}"
						var="solicitante" itemLabel="#{solicitante.nome}"
						itemValue="#{solicitante.codigo}" style="font-size: 13px;" />
					<p:ajax global="false" />
				</p:selectOneMenu>
			</div>
			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.label_responsavel}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu value="#{gerenciaChamadoTela.responsavelFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="" />
					<f:selectItems value="#{gerenciaChamadoTela.responsaveisFiltro}"
						var="responsavel" itemLabel="#{responsavel.nome}"
						itemValue="#{responsavel.codigo}" style="font-size: 13px;" />
					<p:ajax global="false" />
				</p:selectOneMenu>
			</div>
			<div
				style="margin-top: 5px; padding-left: 12px; padding-right: 24px; float: left; clear: both;">
				<p:commandButton value="#{message.botao_filtrar}"
					icon="ui-icon-search" style="margin-left:30px; font-size: 14px;"
					action="#{gerenciaChamadoTela.filtrarIniciar}" update=":formChIni" />
			</div>
		</div>

	</h:form>




	<div align="left" style="padding-left: 3px; padding-top: 8px;">
		<h:form id="formChIni">
			<p:dataTable var="chamado" id="idTChIni"
				value="#{gerenciaChamadoTela.chamadosIniciar}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20" rows="10" paginator="true"
				rowKey="#{chamado.codigo}" emptyMessage="#{message.msg_semvalores}"
				rowStyleClass="#{gerenciaChamadoTela.pintaLinha2(chamado)}">

				<f:facet name="header">
					<div style="float: left;">
						<div style="padding-top: 6px; float: left">
							<h:outputText value="#{message.msg_legenda}  "
								style="font-size: 11px;" />
						</div>
						<p:commandButton value=""
							actionListener="#{gerenciaChamadoTela.ordenaFinalizado}" id="prz"
							update="idTChIni" styleClass="legenda_botao"
							style="background-image: url(img/comprada.jpg);">
						</p:commandButton>
						<p:tooltip for="prz" value="#{message.label_atendido}"
							showEffect="fade" hideEffect="fade" />

						<p:commandButton value=""
							actionListener="#{gerenciaChamadoTela.ordenaAndamentoAtrasado}"
							id="atr" styleClass="legenda_botao" update="idTChIni"
							style="background-image: url(img/recebida.jpg);">
						</p:commandButton>
						<p:tooltip for="atr" value="#{message.label_atrasado}"
							showEffect="fade" hideEffect="fade" />

						<p:commandButton value=""
							actionListener="#{gerenciaChamadoTela.ordenaAndamento}" id="and"
							styleClass="legenda_botao" update="idTChIni"
							style="background-image: url(img/aprovada.jpg);">
						</p:commandButton>
						<p:tooltip for="and" value="#{message.label_andamento}"
							showEffect="fade" hideEffect="fade" />

						<p:commandButton value=""
							actionListener="#{gerenciaChamadoTela.ordenaAberto}" id="blo"
							styleClass="legenda_botao" update="idTChIni"
							style="background-image: url(img/bloqueada.jpg);">
						</p:commandButton>
						<p:tooltip for="blo" value="#{message.label_nao_iniciado}"
							showEffect="fade" hideEffect="fade" />

					</div>
				</f:facet>

				<p:column style="width:4%">
					<p:rowToggler />
				</p:column>

				<p:column style="width:1%">
					<f:facet name="header">  
                    Prio. 
            		</f:facet>
					<p:graphicImage value="img/semaforo_verde.png"
						rendered="#{chamado.tipoProblema.prioridade.equals('Baixa') and chamado.status.equals('Aberto')}"
						title="#{chamado.tipoProblema.prioridade}" />
					<p:graphicImage value="img/semaforo_amarelo.png"
						rendered="#{chamado.tipoProblema.prioridade.equals('Média') and chamado.status.equals('Aberto')}"
						title="#{chamado.tipoProblema.prioridade}" />
					<p:graphicImage value="img/semaforo_vermelho.png"
						rendered="#{chamado.tipoProblema.prioridade.equals('Alta') and chamado.status.equals('Aberto')}"
						title="#{chamado.tipoProblema.prioridade}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.codigo}">
					<f:facet name="header">  
                    #{message.label_num_chamado} 
            		</f:facet>
					<h:outputText value="#{chamado.codigo}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamado.tipoProblema.destinoChamado}">
					<f:facet name="header">  
                    #{message.label_destino} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.destinoChamado}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamado.tipoProblema.descricao}">
					<f:facet name="header">  
                    #{message.label_assunto} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.descricao}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.dataEmissao}">
					<f:facet name="header">  
                    #{message.solicita_dt_emissao } 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataEmissao)}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.dataAprovacao}">
					<f:facet name="header">  
                    #{message.label_dt_aprova } 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataAprovacao)}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.usuario.nome}}">
					<f:facet name="header">  
                    #{message.solicita_solicitante} 
            		</f:facet>
					<h:outputText value="#{chamado.usuario.nome}" />
				</p:column>


				<p:column style="width:10%"
					sortBy="#{chamado.usuarioResponsavel.nome}">
					<f:facet name="header">  
                    #{message.label_responsavel} 
            		</f:facet>
					<h:outputText value="#{chamado.usuarioResponsavel.nome}" />
				</p:column>


				<p:column style="width:10%">
					<f:facet name="header">  
                    #{message.label_acoes} 
            		</f:facet>

					<p:commandButton id="butTroca2" icon="ui-icon-transferthick-e-w"
						styleClass="ButtonPesq" style="margin-left: 10px;"
						oncomplete="dlg15.show()" update=":formAltDes:editaAltDes"
						rendered="#{gerenciaChamadoTela.verificaChamado(chamado)}">
						<f:setPropertyActionListener
							target="#{gerenciaChamadoTela.chamado}" value="#{chamado}" />
					</p:commandButton>

					<p:commandButton id="butIni" icon="ui-icon-play"
						styleClass="ButtonPesq" style="margin-left: 10px;"
						action="#{gerenciaChamadoTela.iniciaChamado}"
						update=":messages,:formChIni"
						rendered="#{chamado.status.equals('Aberto') and chamado.usuarioResponsavel.codigo.equals(usuario.codigo) ? true : false}">
						<f:setPropertyActionListener
							target="#{gerenciaChamadoTela.chamado}" value="#{chamado}" />
					</p:commandButton>

					<p:commandButton id="butInf" icon="ui-icon-flag"
						styleClass="ButtonPesq" style="margin-left: 10px;"
						action="#{gerenciaChamadoTela.preencheProgresso(chamado)}"
						oncomplete="dlg17.show()"
						update=":messages,idTChIni,:formInfHis:inpProg,:formInfHis:outProg,:formInfHis:sliProg"
						rendered="#{gerenciaChamadoTela.verificaChamado(chamado)}">
						<f:setPropertyActionListener
							target="#{gerenciaChamadoTela.chamado}" value="#{chamado}" />
					</p:commandButton>

					<p:commandButton id="butAnexo" styleClass="ButtonPesq"
						icon="ui-icon-arrowthickstop-1-s" ajax="false"
						rendered="#{chamado.arquivo != null ? true : false}"
						style="margin-left: 10px;">
						<p:fileDownload value="#{chamadoTela.downloadArquivo(chamado)}" />
					</p:commandButton>

					<p:commandButton id="butHist" icon="ui-icon-search"
						styleClass="ButtonPesq" style="margin-left: 10px;"
						action="#{gerenciaChamadoTela.preencheHistorico(chamado)}"
						oncomplete="dlgHist.show();" update=":descHist"
						rendered="#{chamado.historicos.size() > 0 ? true : false}" />

					<p:tooltip for="butHist" value="#{message.label_ver_historico}" />
					<p:tooltip for="butAnexo" value="#{message.label_anexo}" />
					<p:tooltip for="butIni" value="#{message.label_inicia_chamado}" />
					<p:tooltip for="butInf" value="#{message.label_inf_andamento}" />
					<p:tooltip for="butTroca2" value="#{message.label_trocar_destino}" />

				</p:column>

				<p:rowExpansion>

					<div style="margin-top: 30px;">
						<div style="float: left; padding-left: 8px;">
							<h:panelGrid columns="2" cellpadding="1" style="width:300px;"
								columnClasses="label, value">

								<h:outputText style="font-weight: bold;"
									value="#{message.solicita_filial}" />

								<h:outputText
									value="#{chamado.usuario.filial.filial} (#{chamado.usuario.filial.descricao}) " />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_dt_previsao}" />

								<h:outputText
									value="#{chamadoTela.converteData(chamado.dataPrevisao)}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_progresso}" />

								<h:outputText value="#{chamado.progresso}%" />

								<h:outputText style="font-weight: bold;" value="Ramal" />
								
								<h:outputText value="#{chamado.ramal}" />
								
								<h:outputText style="font-weight: bold;"
									value="#{message.label_email}" />

								<h:outputText
									value="#{chamado.usuario.email}" />

							</h:panelGrid>
						</div>
						<div style="float: left; margin-left: 30px;">
							<h:panelGrid columns="1" cellpadding="1"
								style="width:700px;center;">
								<h:outputText style="font-weight: bold;"
									value="#{message.label_comentario}" />
								<h:outputText escape="false" value="#{chamado.descricao}" />
							</h:panelGrid>
						</div>

						<div style="margin-top: 30px; margin-left: 30px;"></div>
					</div>


				</p:rowExpansion>
				<f:facet name="footer">
					<div style="float: left;">
						<div style="padding-top: 2px; float: left">
							<h:outputText value="#{message.msg_legenda}  "
								style="font-size: 11px;" />
						</div>

						<p:graphicImage style="padding-left:10px" id="prz2"
							value="img/comprada.jpg" />
						<p:tooltip for="prz2" value="#{message.label_atendido}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="atr2"
							value="img/recebida.jpg" />
						<p:tooltip for="atr2" value="#{message.label_atrasado}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="and2"
							value="img/aprovada.jpg" />
						<p:tooltip for="and2" value="#{message.label_andamento}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="blo2"
							value="img/bloqueada.jpg" />
						<p:tooltip for="blo2" value="#{message.label_nao_iniciado}"
							showEffect="fade" hideEffect="fade" />

					</div>
				</f:facet>
			</p:dataTable>

			<p:confirmDialog message="#{message.msg_exclui_chamado}"
				header="#{message.header_exclui_chamado}" severity="alert"
				widgetVar="excluiChamado" appendToBody="true">
				<p:commandButton id="confirm" value="#{message.msg_sim}"
					oncomplete="excluiChamado.hide();"
					actionListener="#{chamadoTela.excluiChamado}" global="false"
					update=":messages,@form" />
				<p:commandButton id="decline" value="#{message.msg_nao}"
					onclick="excluiChamado.hide();" type="button" global="false" />
			</p:confirmDialog>

		</h:form>
	</div>
</h:body>

</html>
